package com.guodi.map.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.guodi.map.entity.MapFunction;
import com.guodi.map.mapper.MapFunctionMapper;
import com.guodi.map.service.IMapFunctionService;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @描述：地图功能模块表 服务类
 * @作者: 代鹏刚
 * @日期: 2019-12-13
 */
@Service
public class MapFunctionServiceImpl extends ServiceImpl<MapFunctionMapper, MapFunction> implements IMapFunctionService {

    @Override
    public List<MapFunction> listByEntity(MapFunction mapFunction) {
        LambdaQueryWrapper<MapFunction> lambdaQueryWrapper = (new QueryWrapper()).lambda();
        if(StringUtils.isNotBlank(mapFunction.getName())){
            lambdaQueryWrapper.like(MapFunction::getName,mapFunction.getName());
        }
        lambdaQueryWrapper.orderByAsc(MapFunction::getSort);
        return this.list(lambdaQueryWrapper);
    }
}